package plug_in_javafx_dt;

import java.util.logging.LogManager;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;



public class PluginJFXDT extends AbstractUIPlugin {
	
	// The plug-in ID
    public static final String PLUGIN_ID = "com.exadel.javafx.ide.core";
    
    // The shared instance
    private static PluginJFXDT plugin;

    /**
     * The constructor
     */
    public PluginJFXDT() {
        LogManager.getLogManager();
        plugin = this;
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
     * )
     */
    public void start(BundleContext context) throws Exception {
        super.start(context);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
     * )
     */
    public void stop(BundleContext context) throws Exception {
        plugin = null;
        super.stop(context);
    }

    /**
     * Returns the shared instance
     * 
     * @return the shared instance
     */
    public static PluginJFXDT getDefault() {
        return plugin;
    }

    /**
     * Log info message
     * @param message
     */
    public static void log(String message) {
        getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, null));
    }

    /**
     * Log exception
     * @param th
     */
    public static void logException(Throwable th) {
        getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, th.getMessage(), th));
    }

}
